{% extends 'layouts/base.html' %}
{% block content %}
<div class="row">
    <div class="col-xs-12">
        <!-- PAGE CONTENT BEGINS -->
        <form action="{{ url('backend/surcharge/add') }}" class="form-horizontal" role="form" method="post" enctype="multipart/form-data">

            <div class="form-group{% if errors['scg_name'] is not empty %} has-error{%endif%}">
                <label for="scg_name" class="col-xs-12 col-sm-3 col-md-3 control-label no-padding-right">名称<span class="red">*</span></label>
                <div class="col-xs-12 col-sm-4">
                    <span class="block input-icon input-icon-right">
                        <input type="text" id="scg_name" placeholder="名称" name="scg_name" class="col-xs-12" value="{{surcharge.scg_name}}" />
                    </span>
                </div>
                <div class="help-block col-xs-12 col-sm-reset inline"> {% if errors['scg_name'] is not empty %}{{errors['scg_name']}}{% else %} {%endif%} </div>
            </div>

            <div class="form-group{% if errors['scg_price'] is not empty %} has-error{%endif%}">
                <label for="scg_price" class="col-xs-12 col-sm-3 col-md-3 control-label no-padding-right">价格<span class="red">*</span></label>
                <div class="col-xs-12 col-sm-4">
                    <span class="block input-icon input-icon-right">
                        <input type="text" id="scg_price" placeholder="价格" name="scg_price" class="col-xs-12" value="{{surcharge.scg_price}}" />
                    </span>
                </div>
                <div class="help-block col-xs-12 col-sm-reset inline"> {% if errors['scg_price'] is not empty %}{{errors['scg_price']}}{% else %} {%endif%} </div>
            </div>

            <div class="form-group{% if errors['unit'] is not empty %} has-error{%endif%}">
                <label for="unit" class="col-xs-12 col-sm-3 col-md-3 control-label no-padding-right">单位<span class="red">*</span></label>
                <div class="col-xs-12 col-sm-4">
                    <span class="block input-icon input-icon-right">
                        <input type="text" id="unit" placeholder="单位" name="unit" class="col-xs-12" value="{{surcharge.unit}}" />
                    </span>
                </div>
                <div class="help-block col-xs-12 col-sm-reset inline"> {% if errors['unit'] is not empty %}{{errors['unit']}}{% else %} {%endif%} </div>
            </div>

            <div class="form-group{% if errors['desciption'] is not empty %} has-error{%endif%}">
                <label for="desciption" class="col-xs-12 col-sm-3 col-md-3 control-label no-padding-right">描述<span class="red">*</span></label>
                <div class="col-xs-12 col-sm-4">
                    <span class="block input-icon input-icon-right">
                        <input type="text" id="desciption" placeholder="描述" name="desciption" class="col-xs-12" value="{{surcharge.desciption}}" />
                    </span>
                </div>
                <div class="help-block col-xs-12 col-sm-reset inline"> {% if errors['desciption'] is not empty %}{{errors['desciption']}}{% else %} {%endif%} </div>
            </div>

            <div class="form-group{% if errors['type'] is not empty %} has-error{%endif%}">
                <label for="type" class="col-xs-12 col-sm-3 col-md-3 control-label no-padding-right">0表示其他，1表示出发楼层，2表示到达楼层<span class="red">*</span></label>
                <div class="col-xs-12 col-sm-4">
                    <span class="block input-icon input-icon-right">
                        <input type="text" id="type" placeholder="0表示其他，1表示出发楼层，2表示到达楼层" name="type" class="col-xs-12" value="{{surcharge.type}}" />
                    </span>
                </div>
                <div class="help-block col-xs-12 col-sm-reset inline"> {% if errors['type'] is not empty %}{{errors['type']}}{% else %} {%endif%} </div>
            </div>

            <div class="form-group{% if errors['addtime'] is not empty %} has-error{%endif%}">
                <label for="addtime" class="col-xs-12 col-sm-3 col-md-3 control-label no-padding-right">添加时间<span class="red">*</span></label>
                <div class="col-xs-12 col-sm-4">
                    <span class="block input-icon input-icon-right">
                        <input type="text" id="addtime" placeholder="添加时间" name="addtime" class="col-xs-12" value="{{surcharge.addtime}}" />
                    </span>
                </div>
                <div class="help-block col-xs-12 col-sm-reset inline"> {% if errors['addtime'] is not empty %}{{errors['addtime']}}{% else %} {%endif%} </div>
            </div>



            <div class="clearfix form-actions">
                <div class="col-md-offset-3 col-md-9">
                    <button class="btn btn-info" type="submit">
                        <i class="ace-icon fa fa-check bigger-110"></i>
                        鎻愪氦
                    </button>

                    &nbsp; &nbsp; &nbsp;
                    <button class="btn" type="reset">
                        <i class="ace-icon fa fa-undo bigger-110"></i>
                        閲嶇疆
                    </button>
                </div>
            </div>
        </form>
    </div><!-- /.col -->
</div><!-- /.row -->

{% endblock %}
{% block script %}

<script type="text/javascript">
    $(document).ready(function(){

        $(".ace-switch").each(function () {
            var aceswitch = this;

            aceswitch.addEventListener("click", function(){
                id = this.id.replace("_radio", "");
                if(this.checked){
                    $("#"+id).val('1');
                } else {
                    $("#"+id).val('0');
                }
                });
        });
    });
</script>
{% endblock %}
